Skip to content

[Ministral 3] Add ministral 3#42498

Merged
ArthurZucker merged 40 commits intohuggingface:mainfrom
patrickvonplaten:add_ministral_3
Dec 1, 2025
Merged

[Ministral 3] Add ministral 3#42498
ArthurZucker merged 40 commits intohuggingface:mainfrom
patrickvonplaten:add_ministral_3

Conversation

@patrickvonplaten
Copy link
Contributor

This PR adds ministral 3



@require_torch
class Ministral3ModelTest(CausalLMModelTest, unittest.TestCase):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this uses the wrong tester class



@require_torch
class Ministral3IntegrationTest(unittest.TestCase):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

integration tests are verified to work on H100

## Usage examples

```py
import torch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's verified that this example works

@TheLocalDrummer
Copy link

Ministral when?

- System Prompt: Maintains strong adherence and support for system prompts.
- Agentic: Offers best-in-class agentic capabilities with native function calling and JSON outputting.
- Edge-Optimized: Delivers best-in-class performance at a small scale, deployable anywhere.
- Apache 2.0 License: Open-source license allowing usage and modification for both commercial and non-commercial purposes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based.

Comment on lines +32 to +34
[mistralai/Ministral-3-8B-Base-2512](https://huggingface.co/mistralai/Ministral-3-8B-Base-2512)
[mistralai/Ministral-3-8B-Instruct-2512](https://huggingface.co/mistralai/Ministral-3-8B-Instruct-2512)
[mistralai/Ministral-3-8B-Reasoning-2512](https://huggingface.co/mistralai/Ministral-3-8B-Reasoning-2512)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based Mistral.

Copy link
Contributor

@juliendenize juliendenize left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some fixes for the code snippets

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest: if the only difference here is that the attn layer now supports L4-style rope extension, why was a whole new arch made instead of extending the regular Mistral LM arch with L4 rope support?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we tried to sneak in Ministral with just a few lines of changes here: #42045 (review)

But transformers design philosophy is to make a new model for this as you can see from comment above 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transformers maintainers can probs give a better answer to this than me though

patrickvonplaten and others added 2 commits December 1, 2025 09:46
Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>
Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

else:
raise ValueError(f"Unknown config type {type(config)}.")

# let's swap nn.Linear to FP8 Linear before loading
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that make sense?

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's goooooo!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, ministral3

@ArthurZucker ArthurZucker merged commit bf3f0ae into huggingface:main Dec 1, 2025
20 of 23 checks passed
sarathc-cerebras pushed a commit to sarathc-cerebras/transformers that referenced this pull request Dec 7, 2025
* Up

* WIP

* WIP

* WIP

* Apply suggestions from code review

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>

* Update src/transformers/models/ministral3/configuration_ministral3.py

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>

* fix most tests

* update docsting

* fixup

* typo in the ocnfig

* make the last 3 tests pass

* fix auto

* nits

* WIP

* WIP

* WIP

* per tensor

* WIP

* WIP

* WIP

* style

* fixup

* WIP

* WIP

* WIP

* hack for now

* add todo

* fixup

* WIP

---------

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>
Co-authored-by: Arthur <arthur.zucker@gmail.com>
Co-authored-by: medmekk <mekk.cyber@gmail.com>
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
* Up

* WIP

* WIP

* WIP

* Apply suggestions from code review

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>

* Update src/transformers/models/ministral3/configuration_ministral3.py

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>

* fix most tests

* update docsting

* fixup

* typo in the ocnfig

* make the last 3 tests pass

* fix auto

* nits

* WIP

* WIP

* WIP

* per tensor

* WIP

* WIP

* WIP

* style

* fixup

* WIP

* WIP

* WIP

* hack for now

* add todo

* fixup

* WIP

---------

Co-authored-by: Julien Denize <40604584+juliendenize@users.noreply.github.com>
Co-authored-by: Arthur <arthur.zucker@gmail.com>
Co-authored-by: medmekk <mekk.cyber@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants